package com.xiemulei.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xiemulei.common.valid.AddGroup;
import com.xiemulei.common.valid.ListValue;
import com.xiemulei.common.valid.UpdateGroup;
import jakarta.validation.constraints.*;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import java.io.Serializable;

/**
 * 品牌
 * 
 * @author xiewenchang
 * @email xiemulei@gmail.com
 * @date 2021-08-06 11:36:46
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@NotNull(message = "修改必须指定品牌id", groups = {UpdateGroup.class})
	@Null(message = "新建时不能指定id", groups = {AddGroup.class})
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名不能为空")
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotBlank(message = "logo地址不能为空")
	@URL(message = "logo地址必须是一个合法的url地址")
	private String logo;
	/**
	 * 介绍
	 */
	@NotBlank
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@NotNull
	@ListValue(values = {0, 1}, message = "0代表不显示，1代表显示")
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@Pattern(regexp = "/[a-zA-Z]/", message = "必须是一个字母")
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull
	@Min(value = 0, message = "排序字段必须大于等于0")
	private Integer sort;

}
